/**
 * ImageItem.java Create on 2012-7-30     
*      
* Copyright (c) 2012-7-30 by yiming     
*      
* @author <a href="alenzhangym@hotmail.com">Yiming</a>     
* @version 1.0 
 */
package com.yimi.service;

import android.os.Parcel;
import android.util.Log;
 

/**
 * TODO
 *  
 *      
 * @author Yiming
 * @version 1.0 
 */
public class BaseImageItem extends Entity{
    public static final int NONE=0;
    public static final int INSDCARD=1;
    public static final int INROM=2;
    public static final int INMEM=3;
    private String TAG = "BaseImageItem";
    protected int index;
    protected String previewURL;
    protected String fileURL; 
    protected int location;  

    /**
     * @param i
     */
    public BaseImageItem() {
       super();  
    }
    
    /**
     * @param baseImageItem
     */
    public BaseImageItem(BaseImageItem baseImageItem) {
         super(); 
         this.index = baseImageItem.index;
         this.fileURL = baseImageItem.fileURL;
         this.previewURL = baseImageItem.previewURL;
         this.location = baseImageItem.location; 
    }
    
    
    public int getLocation() {
        return location;
    }

    public void setLocation(int location) {
        this.location = location;
    }

    public void readToParcel(Parcel in){
        this.index = in.readInt(); 
        this.previewURL=in.readString();
        this.fileURL = in.readString();
        this.location=in.readInt(); 
        Log.e(TAG, " readToParcel location is "+location);
    }
    

    public int getIndex() {
        return index;
    }
    public void setIndex(int index) {
        this.index = index;
    }
     
    public String getPreviewURL() {
        return previewURL;
    }
    public void setPreviewURL(String previewURL) {
        this.previewURL = previewURL;
    }
    public String getFileURL() {
        return fileURL;
    }
    
    public void setFileURL(String fileURL) {
        this.fileURL = fileURL;
    }
 
    public void writePacel(Parcel dest, int flags){
        dest.writeInt(index); 
        Log.e(TAG, "writePacel previewURL is "+previewURL);
        dest.writeString(previewURL);
        dest.writeString(fileURL);
        Log.e(TAG, " writePacel location is "+location);
        dest.writeInt(location); 
    }
    
    public void readFromParcel(Parcel in) {
        Log.e(TAG, "Start to read");
        super.readFromParcel(in);
        this.index = in.readInt(); 
        this.previewURL=in.readString();
        this.fileURL = in.readString();
        this.location = in.readInt(); 
        Log.e(TAG, " readFromParcel location is "+location);
        Log.e(TAG, "read over");
    }
    
     
    /* (non-Javadoc)
     * @see android.os.Parcelable#describeContents()
     */
    @Override
    public int describeContents() { 
        return 0;
    }
    public String toString(){
        String s = super.toString();
        s+="index=";
        s+=index;
        s+="previewURL";
        s+=previewURL;
        s+="location";
        s+=location;
        return s;
    }
}
